<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@include file="../AllLoad.jsp" %>
    
    <script type="text/javascript" src="${server}/app/js/jedate.js"></script>
	<link id="jeDateSkin" type="text/css" rel="stylesheet" href="${server}/app/css/jedate.css">
	<script type="text/javascript" src="${server}/app/js/formatedate.js"></script>
    
<div class="bjui-pageHeader">
	<form method="post" id="pagerForm" action="${server}/orders/unproOrder" data-toggle="ajaxsearch" >
		<ul class="bjui-searchBar">
			<li>
				<label class="trtitle01">姓名：</label>
				<input type="text" size="8" id="name" name="orders.name" value="${name }" class="form-control"/>
			</li>
			<li>
				<label class="trtitle01">产品名称：</label>
				<input type="text" size="8" id="pro_name" name="orders.pro_name" value="${pro_name }" class="form-control"/>
			</li>
			<li>
				<label class="trtitle01">电话：</label>
				<input type="text" size="8" id="mobile" name="orders.mobile" value="${mobile }" class="form-control"/>
			</li>
			<li>
				<label class="trtitle01">订单来源：</label>
				<input type="text" size="8" id="source" name="orders.source" value="${source }" class="form-control"/>
			</li>
			
			<li>
				<label class="trtitle01">订单时间：</label>
				<input type="text" size="8" name="createStartDate" id="createStartDate" value="${createStartDate }"/>
				<input type="text" size="8" name="createEndDate" id="createEndDate" value="${createEndDate }"/>
			</li>
			<li>
				<label class="trtitle01">订单状态：</label>
				<select name="orders.state" id="state" data-toggle="selectpicker">
					<option value="1" <c:if test="${state==1 }">selected = "selected"</c:if>>待发货</option>
				</select>
			</li>
			<li>
				<label class="trtitle01">客户类型 ：</label>
				<select name="orders.xian" id="xian" data-toggle="selectpicker">
					<option value="" <c:if test="${empty xian }">selected = "selected"</c:if>>全部</option>
       				<option value="1" <c:if test="${xian==1 }">selected = "selected"</c:if>>一线</option>
       				<option value="2" <c:if test="${xian==2 }">selected = "selected"</c:if>>二线</option>
       				<option value="3" <c:if test="${xian==3 }">selected = "selected"</c:if>>三线 </option>
				</select>
			</li>
			<li>
			 	<button type="submit" class="btn-default" data-icon="search">查询</button>
			</li>
		</ul>
	</form>
</div>
<div class="bjui-pageContent">
    <div class="bjui-headBar">
        <ul>
			<li class="left"><a href="${server}/orders/delete" class="btn btn-default btn-sm" data-icon="trash-o" data-toggle="doajaxchecked" data-type="post" data-confirm-msg="确定要删除选中项吗？" data-idname="idws" data-group="idww">删除订单</a></li>
			<li class="left"><a onclick="daochu()" id="daochu" class="btn btn-default" data-toggle="navtab" data-icon="button">导出订单(根据查询条件)</a></li>
       </ul>
    </div>
</div>
<div class="pageContent bjui-resizeGrid" style="top: 29px; bottom: 28px;">
	<table data-toggle="tablefixed" data-layout-h="0" data-nowrap="true">
		<thead>
			<tr align="center">
				<th width="35" style="text-align: center;"><input type="checkbox" class="checkboxCtrl" data-group="ids" data-toggle="icheck"/></th>
				<th width="100">产品名称</th>
				<th width="50">购买数量</th>
				<th width="50">订单总额</th>
				<th width="100">创建日期</th>
				<th width="80">订单来源</th>
				<th width="60">订单状态</th>
				<th width="60">客户类型</th>
				<th width="60">姓名</th>
				<th width="80">号码</th>
				<th width="80">地址</th>
				<th width="80">快递单号</th>
				<th width="120">操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${page.result}" var="orders">
				<tr>
					<td  width="35" style="text-align: center;"><input type="checkbox" name="id" data-toggle="icheck" value="${orders.id}" ></td>
					<td title="${orders.pro_name}">${orders.pro_name}</td>
					<td>${orders.num}</td>
					<td>${orders.price}</td>
					<td><fmt:formatDate value="${orders.create_date}" pattern="yyyy-MM-dd HH:mm:ss"/> </td>
					<td title="${orders.source}">${orders.source}</td>
					<td>
						<c:if test="${orders.state==1}">待发货</c:if>
					</td>
					<td>
						<c:if test="${orders.xian==1}">一线</c:if>
						<c:if test="${orders.xian==2}">二线</c:if>
						<c:if test="${orders.xian==3}">三线</c:if>
					</td>
					<td title="${orders.name}">${orders.name}</td>
					<td title="${orders.mobile}">
						<a href="${server}/orders/orderList?mobile=${orders.mobile}" data-toggle="navtab" data-icon="edit" style="color:blue" data-id="control-role-update_view" data-reload-warn="本页已有打开的内容，确定将刷新本页内容，是否继续？"  data-title="回访-${orders.mobile}">${orders.mobile }</a>
						<%-- <a href="${server}/orders/orderList?mobile=${orders.mobile}" style="color:blue" data-id="${orders.mobile}" data-toggle="navtab" data-title="列表">${orders.mobile}</a> --%>
					</td>
					<td title="${orders.area}${orders.address}">${orders.area}${orders.address}</td>
					<td title="${orders.order_number}">${orders.order_number}</td>
					<td>
						<a href="${server}/orders/detail?id=${orders.id}&stat=2" class="btn btn-default" data-toggle="navtab" data-icon="edit" data-id="control-role-update_view" data-reload-warn="本页已有打开的内容，确定将刷新本页内容，是否继续？"  data-title="编辑-${orders.name}">编辑</a>
						<c:if test="${orders.state==0 }"><a class="btn btn-red" data-toggle="doajax" data-type="post" data-confirm-msg="确定要删除该条数据吗？" href="${server}/orders/delete?ids=${orders.id}">删除</a></c:if>
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
</div>
<script type="text/javascript">

	jeDate({
		dateCell:"#createStartDate",
		format:"YYYY-MM-DD",
		isinitVal:false,
		okfun:function(val){alert(val)}
	})
	jeDate({
		dateCell:"#createEndDate",
		format:"YYYY-MM-DD",
		isinitVal:false,
		okfun:function(val){alert(val)}
	})

	function daochu(){
		var pro_name = $("#pro_name").val();
		var name = $("#name").val();
		var mobile = $("#mobile").val();
		var source = $("#source").val();
		var state = $("#state").val();
		var xian = $("#xian").val();
		var createStartDate = $("#createStartDate").val();
		var createEndDate = $("#createEndDate").val();
		window.location.href=server+"/orders/exportExl?pro_name="+pro_name+"&name="+name+"&mobile="+mobile+"&source="+source+"&state="+state+"&xian="+xian+"&createStartDate="+createStartDate+"&createEndDate="+createEndDate;
	}
</script>
<%@include file="../page.jsp" %>